import Config from './config';
import Util from './util';

class SignalRAspNetCoreHelper {
    initSignalR() {
        const encryptedAuthToken = Util.abp.utils.getCookieValue(Config.authorization.encryptedAuthTokenName);

        Util.abp.signalr = {
            autoConnect: true,
            connect: undefined,
            hubs: undefined,
            qs: Config.authorization.encryptedAuthTokenName + '=' + encodeURIComponent(encryptedAuthToken),
            url: Config.remoteServiceBaseUrl + '/signalr',
        };

        Util.loadScript(Config.appBaseUrl + '/lib/abp.signalr-client.js');
    }
}

export default new SignalRAspNetCoreHelper();